import struct
from ctypes import create_string_buffer
from Util.util import checkACC1Byte


def SendDetectionModuleCode(address, code):
    TxDataBuffer = create_string_buffer(5)
    TxDataBuffer[0] = b'\x55'
    TxDataBuffer[1] = b'\xAA'
    TxDataBuffer[2] = struct.pack('B', address)
    TxDataBuffer[3] = struct.pack('B', code)
    ACC = checkACC1Byte(TxDataBuffer[:4])
    TxDataBuffer[4] = struct.pack('B', ACC)
    return TxDataBuffer
    pass